const AlertComponent = ($uibModal) => {
    return {
        restrict: 'E',
        template: require('./alert.html'),
        scope: {
            message: '=',
            isShow: '='
        },
        link: (scope) => {
            scope.$watch('isShow', (val) => {
                if (scope.isShow) {
                    openMultipleModals(scope.message);
                }
            });

            function openMultipleModals(msg) {
                var modalInstance = $uibModal.open({
                    animation: true,
                    ariaLabelledBy: 'modal-title-bottom',
                    ariaDescribedBy: 'modal-body-bottom',
                    templateUrl: 'stackedModal.html',
                    size: 'sm',
                    controller: ['$scope', function ($scope) {
                        $scope.msg = msg;
                    }]
                });

                modalInstance.closed.then(() => {
                    scope.isShow = false;
                });
            }
        }
    }
}
AlertComponent.$inject = ['$uibModal'];
export default AlertComponent;